<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript">
	$(function(){

		$("#pointPerLevel").change(function(){
			$.ajax({
				type:"get",
				url:"getPointForRequest.do",
				data: "level="+$(this).val(),
				dataType:"json",
				success:function(jsonData){
					if(jsonData.nepe!=null){
						alert(jsonData.nepe);
						$("#pointPerLevel").val("");
					}if(jsonData.nme!=null){
						alert(jsonData.nme);
						$("#pointPerLevel").val("");
					}else{
					$("#pointView").html("- "+jsonData.point+" pt");
					}
					
				}
			});
		});
	
	});
	function qForm(){
		var content=document.questionForm.content.value;
		var level=document.questionForm.level;
		if(content==""){
			alert("질문을 입력해주세요");
			return false;
		}else if(level.value==""){
			alert("레벨을 선택하세요");
			return false;
		}

	}


	
</script>
</head>
<body>
<h1 align="center">MENTOR QUESTION</h1>
<form action="sendMentorQuestion.do" name="questionForm" onsubmit="return qForm()">
<table  align="center">	
	<thead><tr>
		<td>MENTOR LEVEL</td>
		<td>
			<select id="pointPerLevel" name="level">
				<option value="">level</option>
				<c:forEach items="${requestScope.llist }" var="l">
				<option value="${l }">${l }</option>
				</c:forEach>
			</select>
			<span id="pointView"></span>
		</td>
	</tr>
	<tr>
		<td align="center">QUESTION</td>
		<td>
			<textarea name="content" cols="40" rows="15" style="margin: 4px 0px 0px; width: 300px; height: 208px; resize:none"></textarea>
		</td>
	</tr>
	<tr>
		<td colspan="2" align="right">
			<input type="submit" value="SEND"> 
		</td>
	</tr></thead>
</table>
</form>
</body>
</html>